package com.aegean.MonitorExamSYS.conduction.action;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.aegean.MonitorExamSYS.conduction.business.ConductionBusiness;
import com.aegean.MonitorExaxSYS.model.ConductionValue;
import com.opensymphony.xwork2.ActionSupport;

@Controller("LoginConduction")
@Scope("prototype")
public class LoginConduction extends ActionSupport {
	@Resource
	ConductionBusiness business;
	private String conduction_Login;
	private String conduction_Password;
	private ConductionValue conduction;
	private boolean success;
	private String msg;
	private String address;
	public boolean isSuccess() {
		return success;
	}
	public void setSuccess(boolean success) {
		this.success = success;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getConduction_Login() {
		return conduction_Login;
	}
	public void setConduction_Login(String conduction_Login) {
		this.conduction_Login = conduction_Login;
	}
	public String getConduction_Password() {
		return conduction_Password;
	}
	public void setConduction_Password(String conduction_Password) {
		this.conduction_Password = conduction_Password;
	}
	@Override
	public String execute() throws Exception {
		HttpSession session=ServletActionContext.getRequest().getSession();
		conduction=business.loginConduction(conduction_Login,conduction_Password);
		if(conduction==null){
			msg="对不起，您的用户名或者密码不正确！";
			success=false;
		}else{
			msg="登录成功，页面正在跳转........";
			session.setAttribute("ConductionLogin",conduction);
			address= "../main.jsp";
			success=true;
		}
		// TODO Auto-generated method stub
		return SUCCESS;
	}
	

}
